package com.bykj.taketurns.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.widget.DrawerLayout;
import android.view.View;

import com.bykj.taketurns.R;
import com.bykj.taketurns.fragment.ReadViewFragment;
import com.bykj.taketurns.widget.ViewPager;

import java.util.ArrayList;

public class ReadWordActivity extends BaseActivity {
    private int widthPixels;
    private int heightPixels;
    private View mRight;
    private DrawerLayout mDrawer;
    private ViewPager viewPager;
    private ArrayList<Fragment> fragments = new ArrayList<>();

    //初始化控件
    @Override
    public void initView(Bundle savedInstanceState) {
        viewPager = (ViewPager) setViewById(R.id.read_viewpager);
//        mDrawer = (DrawerLayout) setViewById(R.id.drawer_read);
//        mRight=setViewById(R.id.right_read);
        //fullScreen();
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        for (int i=0;i<10;i++){
            ReadViewFragment fragment=new ReadViewFragment();
            fragments.add(fragment);
        }
        //适配fragment
        viewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
            @Override
            public Fragment getItem(int position) {
                return fragments.get(position);
            }

            @Override
            public int getCount() {
                return fragments.size();
            }
        });
    }

    @Override
    public int getParentView() {
        return R.layout.activity_read_word;
    }

    @Override
    public void initToolBar() {

    }

    @Override
    protected void postData() {

    }

    @Override
    public void onClick(View view) {

    }
//    public void fullScreen(){
//        //右边侧换菜单显示全屏
//        DisplayMetrics metric = new DisplayMetrics();
//        getWindowManager().getDefaultDisplay().getMetrics(metric);
//        widthPixels = metric.widthPixels;
//        heightPixels = metric.heightPixels;
//        ViewGroup.LayoutParams leftParams = mRight.getLayoutParams();
//        leftParams.width=widthPixels;
//        leftParams.height=heightPixels;
//        mRight.setLayoutParams(leftParams);
//    }
}
